//
//  BeautyListModel.m
//  BeautyList
//
//  Created by 李良林 on 2020/12/6.
//  Copyright © 2020 李良林. All rights reserved.
//

#import "BeautyListModel.h"
#import <JRMemory/MemScan.h>
#import <UIKit/UIKit.h>
#import "LZListPopView.h"

@implementation BeautyListModel



+ (void)handleEvent:(NSString *)title open:(BOOL)open
{


    NSLog(@"%@:%@",title,@(open));
    if ([title isEqualToString:@"吐球加速"]) {
        if (open) {
            // 开启功能
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{

                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x100000000,0x160000000};

                float search = 0.12;
                engine.JRScanMemory(range, &search, JR_Search_Type_Float);

                vector<void*>results = engine.getAllResults();

                float modify = 0.06;

                for(int i =0;i<results.size();i++){

                    void *add = results[i];

                    NSString *addstr = [NSString stringWithFormat:@"%p",add];

                    if ([addstr hasSuffix:@"2dc"]) {

                        engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_Float);

                        continue;
                    } else {


                    }

                }


            });
        }else {
            // 关闭功能
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x100000000,0x160000000};
                float search = 0.06;
                engine.JRScanMemory(range, &search, JR_Search_Type_Float);

                vector<void*>results = engine.getAllResults();
                float modify = 0.12;

                for(int i =0;i<results.size();i++){

                    void *add = results[i];

                    NSString *addstr = [NSString stringWithFormat:@"%p",add];

                    if ([addstr hasSuffix:@"2dc"]) {

                        engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_Float);

                        continue;
                    } else {


                    }
                }
            });
        }
    } else if ([title isEqualToString:@"分身加速"]) {
        if (open) {
            // 开启功能
                        dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
                        dispatch_async(queue, ^{
                            JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                            AddrRange range = (AddrRange){0x100000000,0x160000000};
                            float search = 0.0599999866;
                            engine.JRScanMemory(range, &search, JR_Search_Type_Float);

                            vector<void*>results = engine.getAllResults();
                            uint32_t modify = -100;

                            for(int i =0;i<results.size();i++){

                                engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_ULong);

                            }
                        });
        }else {
            // 关闭功能
                        dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
                        dispatch_async(queue, ^{
                            JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                            AddrRange range = (AddrRange){0x100000000,0x160000000};
                            uint32_t search = -100;
                            engine.JRScanMemory(range, &search,JR_Search_Type_ULong);

                            vector<void*>results = engine.getAllResults();
                            float modify = 0.0599999866;

                            for(int i =0;i<results.size();i++){

                                engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_Float);


                            }
                        });
        }

    } else if ([title isEqualToString:@"手感增强"]) {
        if (open) {
            // 开启功能
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x100000000,0x160000000};
                float search = 0.08;
                engine.JRScanMemory(range, &search, JR_Search_Type_Float);

                vector<void*>results = engine.getAllResults();

                float modify = 0;

                for(int i =0;i<results.size();i++){

                    void *add = results[i];

                    NSString *addstr = [NSString stringWithFormat:@"%p",add];

                    if ([addstr hasSuffix:@"2b8"]) {

                        engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_Float);

                        continue;

                    } else {


                    }


                }
            });
        }else {
            // 关闭功能

            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x100000000,0x160000000};
                float search = 0;
                engine.JRScanMemory(range, &search, JR_Search_Type_Float);

                vector<void*>results = engine.getAllResults();

                float modify = 0.08;

                for(int i =0;i<results.size();i++){

                    void *add = results[i];

                    NSString *addstr = [NSString stringWithFormat:@"%p",add];

                    if ([addstr hasSuffix:@"2b8"]) {

                        engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_Float);

                        continue;

                    } else {


                    }


                }
            });
        }

    } else if ([title isEqualToString:@"开启防封"]) {
        if (open) {
            // 开启功能
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x100000000,0x160000000};
                uint32_t search = 67109633;
                engine.JRScanMemory(range, &search, JR_Search_Type_ULong);

                vector<void*>results = engine.getAllResults();

                float modify = 0;

                for(int i =0;i<results.size();i++){

                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_ULong);
                }
            });


            dispatch_queue_t queue1 = dispatch_queue_create("net.bujige.testQueue1", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue1, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x100000000,0x160000000};
                uint32_t search = 134218241;
                engine.JRScanMemory(range, &search, JR_Search_Type_ULong);

                vector<void*>results = engine.getAllResults();

                float modify = 0;

                for(int i =0;i<results.size();i++){

                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_ULong);
                }
            });

        }else {
            // 关闭功能
        }

    }
}

#pragma mark - 输入框的功能初
+ (void)textEvent:(NSString *)title open:(float)open {
    
    if ([title isEqualToString:@"破釜沉舟"]){
        
        
        [LZListPopView showAlertViewWithTitle:@"破釜沉舟" andMessage:@"修改" andleftBtnTitle:@"取消" andrightBtnTitle:@"确定" andTextPlaceholder:@"请输入要修改的值" andBtnBlock:^(NSString * _Nonnull text) {
           
            
            
            
        }];
        
        
    } else if ([title isEqualToString:@"翻云覆雨"]) {
        
        
        [LZListPopView showAlertViewWithTitle:@"翻云覆雨" andMessage:@"修改" andleftBtnTitle:@"取消" andrightBtnTitle:@"确定" andTextPlaceholder:@"请输入要修改的值" andBtnBlock:^(NSString * _Nonnull text) {
           
            
            
            
        }];
        
    }
    
    
}

@end
